﻿<?xml version="1.0" encoding="utf-8"?>
<developerConceptualDocument
  xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5"
  xmlns:xlink="http://www.w3.org/1999/xlink">

  <introduction>
    <para>
    Here are the coding guidelines for the Peter project. In general we
    agree to adhere to the standard C# coding guidelines with the following
    items pointed out as important to the Peter project.
    </para>

    <autoOutline />
  </introduction>

  <section address="Indentation">
    <title>Indentation</title>
    <content>
      <para>All indentation must be as tabs, or 4 spaces.</para>
      <alert class="tip">
		To use tabs only, in VS2005 goto Tools->Options. In the options dialog
		expand "Text Editor"; expand "C#"; select "Tabs" and select "Keep Tabs".
		(make sure your tab size is 4!) Once that is done, you can then goto
		Edit->Advanced->Format Document. This will convert all your spaces to
		tabs.
	  </alert>
    </content>
  </section>

  <section address="Header">
    <title>Header</title>
    <content>
    We need to place the header below in all of our source files, this
    is not optional.
    <code language="none">
	//**************************************************************************
	// Copyright 2008 Peter Project (http://www.codeplex.com/peter)
	// The Programmer's Extensible Text EditoR
	//
	// License : GNU General Public License (GPL)
	// For full text of the license please goto:
	// http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
	//
	// This code is provided on an AS IS basis, with no WARRANTIES,
	// CONDITIONS or GUARANTEES of any kind.
	//
	//		File: "name of file.cs"
	//
	//**************************************************************************
	</code>
	</content>
  </section>
  
  <section address="CodeBlocks">
  <title>Code Blocks</title>
  <content>
  The general layout of code is shown below.
  <list class="ordered">
  <listItem>Every Class, method and property should have a summary, explaning its purpose.</listItem>
  <listItem>Fields should have summaries, but it is not necessary.</listItem>
  <listItem>Avoid public Fields.</listItem>
  <listItem>Place brackets on seperate lines.</listItem>
  <listItem>Add regions where logical.</listItem>
  <listItem>Summaries for properties - add Gets and/or Sets to the beginning of
  the summary if the property will get and/or set values (see below).</listItem>
  <listItem>Do not bunch tons of code on one line, feel free to use multiple
  lines.</listItem>
  <listItem>KEEP CODE CLEAN!!!</listItem>
  </list>
  
  <code language="C#">
	namespace Peter
	{
		/// <summary>
		/// A wrapper for the #Develop TextEditor control...
		/// </summary>
		public class Editor : DockContent, IPeterPluginTab, IHtmlInterface
		{
			/// <summary>
			/// #Develop TextEditor control...
			/// </summary>
			private TextEditorControl m_Editor;
			
			/// <summary>
			/// Sets up the Editor...
			/// </summary>
			/// <param name="config">Class that holds Editor options.</param>
			public void SetupEditor(Common.EditorConfig config)
			{
				...
			}
			
			/// <summary>
			/// Gets or Sets the Highligthing for the Editor...
			/// </summary>
			public string Highlighting
			{
				get { return this.m_Editor.Document.HighlightingStrategy.Name; }
				
				set
				{
				    this.m_Editor.Document.HighlightingStrategy =
				    	HighlightingManager.Manager.FindHighlighter(value);
				}
			}
		}
	}
  </code>
  </content>
  </section>
  
  <relatedTopics>
    <externalLink>
        <linkText>Coding Guidlines at MSDN</linkText>
        <linkAlternateText>Link to coding guidelines at MSDN</linkAlternateText>
        <linkUri>http://msdn.microsoft.com/en-us/library/ms229042(VS.80).aspx</linkUri>
    </externalLink>
  </relatedTopics>
</developerConceptualDocument>
